package cn.tedu.spring.scope;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * 作用域测试类
 */
public class TestUserController {
    public static void main(String[] args) {
        ApplicationContext context = new AnnotationConfigApplicationContext("cn.tedu.spring.scope");
        /*
         * 单例和多例测试
         * 单例singleton：多次获取Bean对象,内存地址相同;
         * 多例：多次获取Bean对象,内存地址不同.
         */
        UserController bean1 = context.getBean(UserController.class);
        System.out.println(bean1);
        UserController bean2 = context.getBean(UserController.class);
        System.out.println(bean2);
    }
}
